package com.jt.demo6;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component//Spring自动为该注解表
public class User {
    public User(){
        System.out.println("创建成功");
    }
    //初始化注解
    @PostConstruct
    public void init(){
        System.out.println("属性/神奇！！！");
    }
    //业务方法手动调用
    public void hello(){
        System.out.println("我爱学java");
    }
    //销毁方法
    @PreDestroy
    public void destory(){
        System.out.println("调用销毁方法,销毁对象");
    }
}
